<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <div id="demo"></div>
  <script>
    var oInput = document.createElement('input');
    document.querySelector('#demo').appendChild(oInput)//这一行相当于 inserted
    oInput.focus();//可以生效
  </script>
</body>

</html>